Using the Tooltip Component
The Tooltip Component, included with the Macromedia Flash UI Components Set 3, provides a small tooltip window activated when the user hovers over items within a Flash movie. This can help make Macromedia Flash applications more useable by providing context sensitive information and feedback to the user about the functionality of specific elements.
The component is extremely customizable, allowing the developer to embed both fonts and movie clips, specify the color, and customize how fast the component opens and closes.
When the user moves the mouse over the item, the Tooltip Component will appear. When they move their mouse away from the item, the Tooltip Component will close.
Sample files
Before you begin this tutorial, download the source file so that you can follow along in Macromedia Flash MX:Using the Tooltip component
Using the Tooltip Component requires that it be inserted into the Macromedia Flash application from the components panel and attached to the item that it will be associated with. A small icon will snap to the item to show that the Tooltip Component is associated with it. The Tooltip Component can attach to buttons, movie clips, and other components. It is intended to work with simple components, such as the PushButton Component, but may not work correctly when attached to more complex components. If you need to attach a Tooltip Component to another component, be sure to thoroughly test your application.
Button component with Tooltip component attached (icon appears in top left corner).
Customizing the Tooltip component
There are a number of ways to control and customize the component.
The first involves using the Property inspector to specify the initial settings for the component. A list of the available properties and a short description of each setting is provided below:
- Tip Text: The text to be displayed within the tooltip.
- Delay: The amount of time that the tooltip will be open before it will open once the user moves over the element that it is attached to, or the amount of time before it will close once the user moves away from the element.
- Fade In Length: The amount of time that it takes for the tooltip to fade in (in milliseconds).
- Fade Out Length: The amount of time that it takes for the tooltip to fade out (in milliseconds).
- Display Drop Shadow: Specifies whether or not a drop shadow should be displayed under the tooltip.
- Use Fade: Specifies whether the tooltip should fade in and out when it opens and closes.
- Use Hand Cursor: Specifies whether or not the target of the tooltip should display a hand cursor when the mouse moves over it.
- ActiveState: Denotes if the tooltip is active, useable and visible when the SWF file starts.
- Face Color: Defines the color of the tooltip face.
- Text Color: Defines the color of the text within the tooltip.
- Tip Target: The instance name of the element that the tooltip is attached to.
You can also customize the Tooltip at runtime, by using the Tooltip component’s ActionScript API.
You can view a complete list of the API, as well as descriptions and examples, in the Macromedia Flash MX Reference Panel (select Window > Reference Panel) under the Flash UI Components Set 3 section.
Finally, the component can be customized through the use of FStyleFormat properties. The following properties are supported:
- FStyleFormat.face
- FStyleFormat.border
- FStyleFormat.shadow
- FStyleFormat.textAlign
- FStyleFormat.textBold
- FStyleFormat.textColor
- FStyleFormat.textFont
- FStyleFormat.textIndent
- FStyleFormat.textItalic
- FStyleFormat.textLeftMargin
- FStyleFormat.textRightMargin
- FStyleFormat.textSize
- FStyleFormat.textUnderline